/***
 * CaRComp Translator
 * 
 * Copyright (C) 2011 Taylor L. Riche
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ***/

package translator.objects;

import java.io.PrintStream;

public class Connector extends Entity {

	protected String sourceID;
	protected String destinationID;
	protected String sc_name;
	protected String sp_name;
	protected String dc_name;
	protected String dp_name;
	
	public Connector(String name, String source, String destination) {
		super(name);
		this.sourceID = source.replace("\"", "");
		this.destinationID = destination.replace("\"", "");
	}
	
	public String getText() {
		return this.getIdent() + ":" + this.sourceID + "->" + this.destinationID;
	}
	
	@Override
	public void generateCode(PrintStream fo) {
		String argString = this.sc_name + "\', \'" + this.sp_name + "\', \'" + this.dc_name + "\', \'" + this.dp_name;
		fo.println("\t\tself.create_connection(\'" + argString + "\')");
	}
	
	public void setNames(String sc_name, String sp_name, String dc_name, String dp_name) {
		this.sc_name = sc_name;
		this.sp_name = sp_name;
		this.dc_name = dc_name;
		this.dp_name = dp_name;
	}

	public String getSourceID() {
		return sourceID;
	}

	public String getDestinationID() {
		return destinationID;
	}

}
